function classUser() {}

classUser.prototype.userName = null;
classUser.prototype.firstName = null;
classUser.prototype.lastName = null;
classUser.prototype.fbUserId = null;
classUser.prototype.accessToken = null;
classUser.prototype.city= null;
classUser.prototype.country= null;
classUser.prototype.sessionid = null;


classUser.prototype.set_user_name = function (user_name) {
    this.userName = user_name;
}

classUser.prototype.set_first_name = function (first_name) {
    this.firstName = first_name;
}

classUser.prototype.set_last_name = function (last_name) {
    this.lastName = last_name;
}

classUser.prototype.set_fb_user_id = function (fb_user_id) {
    this.fbUserId = fb_user_id;
}

classUser.prototype.set_access_token = function (fb_access_token) {
    this.accessToken = fb_access_token;
}

classUser.prototype.set_city = function (city) {
    this.city = city;
}

classUser.prototype.set_country = function (country) {
    this.country = country;
}


classUser.prototype.get_curr_session = function () {
    return this.sessionid;
}

classUser.prototype.save = function (callback) {

    $.ajax({
        type: "POST",
        url: "http://localhost:8080/soshal/api/1.0/user/",
        data: JSON.stringify(this),
        dataType: "json",
        success: function (apiResponse) {
            var currSessionID = apiResponse.sessionId;
            this.sessionid= currSessionID;
            if (callback !== undefined)
             callback(null, currSessionID);
        },
        error: function (apiResponse) {
            alert("error  : " + apiResponse);
            this.sessionid= "Error";
            callback("error", null);
        }
    });
}
